.editor-popup-container {
  .highlight-defined-variable {
    color: var(--requestly-color-primary-text);
    cursor: pointer;
  }

  .highlight-undefined-variable {
    color: var(--requestly-color-error-text);
    cursor: pointer;
  }

  .cm-editor {
    margin-top: -4px;
  }

  .cm-content {
    caret-color: inherit;
  }

  .cm-focused {
    outline: none;
  }

  .cm-scroller {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    overflow: hidden;
  }

  .cm-tooltip-hover {
    background-color: var(--requestly-color-surface-0);
    color: var(--requestly-color-text-default);
    border-radius: 4px;
    padding: 4px;
    font-size: var(--requestly-font-size-xs);
    line-height: var(--requestly-font-line-height-xs);
    box-shadow: 0px 16px 24px -4px rgba(0, 0, 0, 0.32);
    z-index: 10;
  }
}

div.n-popup {
  position: absolute;
  background-color: #333;
  color: white;
  padding: 5px;
  border-radius: 3px;
  white-space: nowrap;
  font-size: var(--requestly-font-size-sm, 12px);
  z-index: 10;
  pointer-events: none; /* Prevent interaction with the popup */
}

.variable-info-popover {
  .ant-popover-inner {
    border-radius: 4px;
    border: 1px solid var(--alias-tokens-color-white-t-20, rgba(255, 255, 255, 0.12));
    background: var(--alias-tokens-color-surface-0, #212121);
    box-shadow: 0px 16px 24px -4px rgba(0, 0, 0, 0.32);

    .ant-popover-inner-content {
      display: flex;
      padding: 0px;
      flex-direction: column;
      gap: 4px;
    }
  }

  .variable-not-found-info-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;

    .variable-info-header {
      position: relative;
      left: -3px;
    }
  }

  .variable-info-body {
    display: flex;
    width: 300px;
    min-width: 240px;
    max-height: 480px;
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
    padding: 0px;
    overflow-y: auto;
    overflow-x: hidden;

    .variable-info-property-container {
      display: flex;
      padding: 8px 12px 8px 12px;
      flex-direction: row;
      align-items: center;
      gap: 8px;
      align-self: stretch;
      border-bottom: 1px solid var(--requestly-color-white-t-10);

      .edit-variable-btn {
        height: 24px;
        margin: 0px;
        margin-left: auto;
        border-radius: 4px !important;
        font-size: var(--requestly-font-size-xs);
        color: var(--requestly-color-text-subtle);
        padding: 8px;
      }
    }

    .variable-info-header {
      display: flex;
      padding: 2px 4px;
      align-items: center;
      gap: 4px;

      color: var(--requestly-color-text-subtle);
      text-align: center;
      font-family: var(--requestly-font-family-default);
      font-size: 9px;
      font-style: normal;
      font-weight: var(--requestly-font-weight-medium);
      line-height: var(--requestly-font-line-height-2xs);
      letter-spacing: 1px;
      text-transform: uppercase;
    }

    .variable-header-info-seperator {
      position: relative;
      left: -10px;
      top: 2px;
      font-size: 10px;
    }

    .variable-info-header-name {
      position: relative;
      left: -12px;
      top: 0.5px;
      overflow: hidden;
      color: var(--requestly-color-text-subtle);
      text-overflow: ellipsis;

      font-family: var(--requestly-font-family-default);
      font-size: var(--requestly-font-size-xs);
      font-style: normal;
    }

    .variable-info-content-container {
      display: flex;
      padding: 6px 12px 12px 12px;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      align-self: stretch;
    }

    .variable-info-content {
      display: grid;
      grid-template-columns: auto auto;
      column-gap: 30px;
      row-gap: 6px;
      width: 100%;
      align-items: start;
      overflow: hidden;
    }

    .variable-info-title {
      overflow: hidden;
      color: var(--requestly-color-text-subtle);
      text-overflow: ellipsis;

      font-family: var(--requestly-font-family-default);
      font-size: var(--requestly-font-size-xs);
      font-style: normal;
      font-weight: var(--requestly-font-weight-normal);
      line-height: 17px;
    }

    .variable-info-value {
      overflow: hidden;
      color: var(--requestly-color-text-default);
      text-overflow: ellipsis;

      font-family: var(--requestly-font-family-default);
      font-size: var(--requestly-font-size-xs);
      font-style: normal;
      font-weight: var(--requestly-font-weight-medium);
      line-height: 17px;
    }

    .add-new-variable-info-content {
      width: 280px;
      font-size: var(--requestly-font-size-xs);
      line-height: var(--requestly-font-line-height-xs);
      color: var(--requestly-color-text-subtle);
    }

    .add-new-variable-btn.rq-custom-btn.ant-btn.ant-btn-block {
      border-radius: 4px;
      height: 24px;
    }

    .variable-not-found-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .switch-environment-btn {
      background: transparent;
      height: 24px;
      border: 1px solid var(--requestly-color-white-t-20);
      border-radius: 4px !important;
      color: var(--requestly-color-text-default);
    }
  }

  // Create Variable Form View
  &.create-form-view {
    .ant-popover-inner {
      width: 304px;
    }
  }
}

// =====================================
// Create Variable View Styles
// =====================================
.create-variable-view {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
  width: 100%;

  // ----------------------------
  // Header
  // ----------------------------
  .create-variable-header {
    display: flex;
    align-items: center;

    .create-variable-title {
      margin: 0;
      font-family: var(--requestly-font-family-default);
      font-size: var(--requestly-font-size-md);
      font-weight: var(--requestly-font-weight-medium);
      color: var(--requestly-color-text-default);
    }
  }

  // ----------------------------
  // Edit Mode Header
  // ----------------------------
  .edit-variable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 8px;
    padding-bottom: 6px;
    margin: 0px -12px;
    border-bottom: 1px solid var(--requestly-color-white-t-10);

    .edit-variable-scope-info {
      display: flex;
      align-items: center;
      gap: 8px;

      .scope-icon-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 16px;
        background-color: var(--requestly-color-primary);
        border-radius: 4px;
        color: var(--requestly-color-text-default);
        font-size: 12px;
      }

      .scope-name {
        font-family: var(--requestly-font-family-default);
        font-size: var(--requestly-font-size-sm);
        font-weight: var(--requestly-font-weight-medium);
        color: var(--requestly-color-text-default);
        margin-right: 4px;
      }
    }

    .edit-variable-actions {
      display: flex;
      gap: 8px;

      .rq-custom-btn {
        height: 24px;
        border-radius: 4px !important;
      }
    }
  }

  // Variable Name in Edit Mode
  .edit-variable-name {
    font-family: var(--requestly-font-family-default);
    font-size: var(--requestly-font-size-lg);
    font-weight: var(--requestly-font-weight-medium);
    color: var(--requestly-color-text-default);
    padding: 8px 0;
  }

  .create-variable-form {
    display: flex;
    flex-direction: column;
    gap: 8px;

    .form-row {
      display: flex;
      align-items: center;
      gap: 6px;

      .form-label {
        width: 72px;
        font-family: var(--requestly-font-family-default);
        font-size: var(--requestly-font-size-xs);
        color: var(--requestly-color-text-subtle);
        margin: 0;
      }

      .form-input-wrapper {
        position: relative;
        flex: 1;

        // Common input styling
        .form-input,
        .ant-input,
        .ant-input-number,
        .ant-input-affix-wrapper {
          width: 100%;
          background: none;
          height: 24px;
          font-size: var(--requestly-font-size-xs);
          color: var(--requestly-color-text-default);
          border-radius: 4px;
        }

        .ant-input {
          padding: 6px 11px;
          height: 24px;
          font-size: var(--requestly-font-size-xs);
        }

        .ant-input-number {
          align-items: center;
          display: flex;
          padding: 2px 0;
          height: 24px;
          font-size: var(--requestly-font-size-xs);
        }

        .ant-input-affix-wrapper {
          padding: 0;
          height: 24px;
          font-size: var(--requestly-font-size-xs);
          padding-right: 8px;
        }

        // Boolean switch wrapper
        .boolean-input {
          display: flex;
          justify-content: flex-end;
          align-items: center;
          padding: 7px 0;
        }
      }

      // Ant Select Styles
      .form-select {
        flex: 1;
        height: 24px !important;

        .ant-select-selector {
          background: none;
          border-radius: 4px !important;
          align-items: center;
          height: 24px;
          font-size: var(--requestly-font-size-xs);
          color: var(--requestly-color-text-default);
        }

        .ant-select-selection-item {
          color: var(--requestly-color-text-default);
          align-items: center;
          display: flex;
        }
      }
    }

    // Validation error
    .form-error {
      color: var(--requestly-color-error-text);
      font-size: var(--requestly-font-size-xs);
      margin-top: -4px;
      padding-left: 112px;
    }
  }

  .create-variable-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    .rq-custom-btn {
      height: 30px;
      border-radius: 4px !important;
      font-size: var(--requestly-font-size-sm);

      &:not(:last-child) {
        margin-right: 0;
      }
    }
  }
}

.scope-option {
  display: flex;
  align-items: center;
  gap: 8px;

  .scope-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 16px;
    background-color: var(--requestly-color-surface-2);
    border-radius: 4px;
  }

  .scope-option-label {
    font-family: var(--requestly-font-family-default);
    font-size: var(--requestly-font-size-sm);
    color: var(--requestly-color-text-default);
  }
}

.ant-select-dropdown {
  box-shadow: 0px 16px 24px -4px rgba(0, 0, 0, 0.32);
  background: var(--requestly-color-surface-0);

  .ant-select-item {
    color: var(--requestly-color-text-default);
    font-size: var(--requestly-font-size-xs);
    height: 24px;
    transition: background 0.2s ease;

    &:hover {
      background: var(--requestly-color-primary);
      border-radius: 4px;
    }

    &.ant-select-item-option-disabled {
      color: var(--requestly-color-text-disabled);
      opacity: 0.5;
    }
  }
}
